<template>
  <el-dialog title="撤销报验" :visible.sync="show" :close-on-click-modal="false" :show-close="!btnLoading" width="500px" @closed="$refs.form.resetFields()">
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-form-item prop="inspectionId" class="hide" />
      <el-form-item label="撤销原因" prop="cancelReasonId">
        <el-select v-model="form.cancelReasonId" placeholder="请选择" style="width: 100%">
          <el-option v-for="item in reasonList" :key="item.fid" :label="item.fnameL2" :value="item.fid" />
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer">
      <el-button type="primary" :loading="btnLoading" @click="btnSubmit">确 定</el-button>
      <el-button :disabled="btnLoading" @click="show = false">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
// 撤销报验
import { editFormMixin } from '@/utils/mixin'
import { listCancelReason, revocation } from '@/api/cqCheck'
export default {
  mixins: [editFormMixin],
  data() {
    return {
      addApi: revocation,
      form: {
        inspectionId: '',
        cancelReasonId: ''
      },
      rules: {
        cancelReasonId: [{ required: true, message: '请选择撤销原因' }]
      },
      reasonList: []
    }
  },
  created() {
    listCancelReason()
      .then(res => (this.reasonList = res.data))
      .catch(() => false)
  }
}
</script>
